package work.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import work.entity.Borrow;
import work.repository.BorrowRepository;
import work.service.BorrowService;

import java.util.List;

@Service
public class BorrowServiceImpl implements BorrowService {

    @Autowired
    private BorrowRepository borrowRepository;

    @Override
    public int insertBorrow(Borrow borrow) {
        return borrowRepository.insertBorrow(borrow);
    }

    @Override
    public int updateBorrow(Borrow borrow) {
        return borrowRepository.updateBorrow(borrow);
    }

    @Override
    public List<Borrow> selectByUser(String userId) {
        return borrowRepository.selectByUser(userId);
    }

    @Override
    public List<Borrow> selectByBookId(String bookId) {
        return borrowRepository.selectByBookId(bookId);
    }

    @Override
    public List<Borrow> selectSomeBorrow(Borrow borrow) {
        return borrowRepository.selectSomeBorrow(borrow);
    }

    @Override
    public List<Borrow> selectSomeBorrow1(Borrow borrow) {
        return borrowRepository.selectSomeBorrow1(borrow);
    }

    @Override
    public Borrow selectByUserIdAndBookId(String userId, String bookId) {
        return borrowRepository.selectByUserIdAndBookId(userId, bookId);
    }

    @Override
    public Borrow selectByBorrowId(String borrowId) {
        return borrowRepository.selectByBorrowId(borrowId);
    }
}
